<template>
	<view v-if="vuex_user">
		<u-navbar title-color="#000" :is-back="false" :border-bottom="false">
			<view slot="content" class="nav-bar">
				<text>我的</text>
				<view style="position: relative;" @click="jump('../notice/notice')">
					<my-icon name="notice"></my-icon>
					<!-- <image :src="require('../../static/icon/bell.png')"></image> -->
					<u-badge v-if="vuex_unread_notice_count > 0" :is-dot="vuex_unread_notice_count > 0" :offset="[-4, 26]"></u-badge>
				</view>
			</view>
		</u-navbar>
		<view class="user-info">
			<view class="container">
				<u-avatar :src="vuex_user.avatar" :size="130"></u-avatar>
				<view class="info">
					<view>
						<text class="userName">{{ vuex_user.username }}</text>
						<image v-if="vuex_user.sex!=2" :src="sexIcon"></image>
					</view>
					<text>{{ vuex_user.schooleName }}</text>
				</view>
				<button class="infoBtn" @click="jump('info/information')" type="default">编辑资料</button>
			</view>
		</view>
		<view class="sub-nav">
			<view class="item" @click="jump('myClass/myClass')">
				<image src="../../static/user/daka.png"></image>
				<text>我的班级</text>
			</view>
			<view class="item" @click="jump('myCollection/myCollection')">
				<image :src="require('../../static/user/fenxi.png')"></image>
				<text>我的收藏</text>
			</view>
			<view class="item" @click="jump('myNotic/myNotic')">
				<image :src="require('../../static/user/paihang.png')"></image>
				<text>班级通知</text>
			</view>
			<view class="item" @click="showWarn">
				<image :src="require('../../static/user/jifen.png')"></image>
				<text>我的积分</text>
			</view>
		</view>
		<my-list class="userList">
			<!-- <my-list-item @click="jump('setNoticeTime/setNoticeTime')" title="每日提醒" thumbnail="../../static/user/alarm.png" :right-text="vuex_user.noticeTime ? vuex_user.noticeTime : '未开启'"></my-list-item> -->
			<my-list-item @click="jump('set')" title="设置" thumbnail="../../static/user/setting.png"></my-list-item>
		</my-list>
	</view>
</template>

<script>
export default {
	onLoad() {
	},
	data() {
		return {
			userList:{}
		};
	},
	computed: {
		sexIcon() {
			return this.vuex_user.sex == 0 ? require('../../static/user/boy.png') :require('../../static/user/girl.png');
		}
	},
	onShow(){
		this.$forceUpdate()
	},
	methods: {
		showWarn(){
			uni.showLoading({
			  icon:"none",
				title:"此功能正在研发中,敬请期待"
			})
			setTimeout(function(){uni.hideLoading()},1000)
		},
		// 跳转
		jump(path) {
			uni.navigateTo({
				url: path
			});
			
		},
	}
};
</script>

<style>
page {
	background-color: #f5f5f5;
}
</style>
<style lang="scss" scoped>
	.infoBtn{
		margin-top: 19upx;
	}
/deep/ .u-navbar {
	background: #ffffff !important;
	font-size: 34upx;
	font-weight: 500;
}
// .userList{
// 	background: linear-gradient(to bottom,#f7f7f9, #FFF);
// }
.icon-notice {
	background: linear-gradient(to bottom, #fc7767, #ec412f);
	-webkit-background-clip: text;
	color: transparent;
	float: right;
	margin-right: 30upx;
	font-size: 40upx;
}
.nav-bar {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	image {
		margin-right: 30upx;
		width: 32upx;
		height: 38upx;
	}
	text {
		flex: 1;
		text-align: center;
		padding-left: 62upx;
	}
}
.user-info {
	background-color: #ffffff;
	padding: 0 20upx 40upx 20upx;
	.container {
		width: 100%;
		height: 200upx;
		padding: 35upx 40upx;
		background: url(../../static/user/bg.png) no-repeat center;
		background-size: 100% 100%;
		display: flex;
		.info {
			flex: 1;
			display: flex;
			flex-direction: column;
			justify-content: center;
			margin-left: 30upx;
			line-height: 50upx;
			.userName{
				font-size: 38upx!important;
				opacity: 1!important;
			}
			view {
				font-size: 38upx;
				font-weight: 500;
				color: #ffffff;
				display: flex;
				align-items: center;
				margin-bottom: 8upx;
				image {
					width: 22upx;
					height: 22upx;
					margin-left: 20upx;
				}
			}
			text:last-child {
				opacity: 0.64;
				font-size: 26upx;
				font-weight: 400;
				color: #ffffff;
			}
		}
		button {
			width: 114upx;
			height: 40upx;
			text-align: center;
			line-height: 40upx;
			background: linear-gradient(to right, #fdfaee 0%, #e5d69b 100%);
			border-radius: 20upx;
			font-size: 22upx;
			font-weight: 400;
			color: #363940;
			padding: 0;
		}
	}
}

.sub-nav {
	display: flex;
	justify-content: space-between;
	height: 220upx;
	align-items: center;
	padding: 0 56upx;
	background: linear-gradient(to bottom, #f7f7f9, #fff);
	position: relative;
	.item {
		display: flex;
		flex-direction: column;
		align-items: center;
		image {
			width: 50upx;
			height: 50upx;
			margin-bottom: 27upx;
		}
		text {
			font-size: 26upx;
			font-weight: 400;
			color: #636874;
		}
	}
}
.sub-nav::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #ffffff;
	z-index: -1;
}
/deep/ .list__item:first-child {
	border-top: 1px solid #ebebeb;
}
</style>
